#include<stdlib.h>
#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>


int main()
{
  printf("I am a process, pid:%d\n",getpid());
  printf("exec begin...\n");

  pid_t id=fork();
  if(id==0)
  {
    sleep(3);
    printf("exec begin...\n");
    execl("/usr/bin/ls","ls","-a","-l",NULL); 
    printf("exec end...\n");
    exit(1);
  }
  pid_t rid=waitpid(id,NULL,0);
  if(rid>0)
  {
    printf("wait success\n");
  }
  return 0;
}
